package cn.xinyangtong.manager.controller;

import cn.xinyangtong.manager.entity.TreeNode;
import cn.xinyangtong.manager.service.ItemCatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 商品分类管理
 * Created by fengbo on 2017/6/9.
 */
@Controller
@RequestMapping("/item/cat")
public class ItemCatController {

    @Autowired
    private ItemCatService itemCatService;

    /***
     * 查询商品分类树形列表
     */
    @RequestMapping("/list")
    @ResponseBody
    public List<TreeNode> getItemCatList(@RequestParam(value = "id", defaultValue = "0")Long parentId) {
        return itemCatService.getItemCatList(parentId);
    }
}
